package course.p7_binaryTree.s5_RedBlockTree;

import course.p7_binaryTree.Node;
import org.junit.Test;

import java.util.List;

public class RBTreeTest {

    @Test
    public void insertTest(){
        RBTree one = new RBTree();
        Node node = one.insert(11);
        one.Check3(one.root);
        System.out.println();
        one.insert(2);
        one.Check3(one.root);
        System.out.println();
        one.insert(14);
        one.Check3(one.root);
        System.out.println();
        one.insert(1);
        one.Check3(one.root);
        System.out.println();
        one.insert(7);
        one.Check3(one.root);
        System.out.println();
        Node deleteOne = one.insert(13);
        one.Check3(one.root);
        System.out.println();
        one.insert(15);
        one.Check3(one.root);
        System.out.println();
        one.insert(5);
        one.Check3(one.root);
        System.out.println();
        one.insert(8);
        one.Check3(one.root);
        System.out.println();
        one.insert(4);
        one.Check3(one.root);
        System.out.println();
        one.insert(12);
        one.Check3(one.root);
        System.out.println();
        one.RBDelete(deleteOne);
        one.Check3(one.root);
        System.out.println();
        List<List<Integer>> result = one.levelOrder(one.root);
        for(List<Integer> item:result){
            System.out.println(item);
        }
    }
}
